package com.njust.controller.BeanNameUrlHander;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 使用BeanNameUrlHandlerMapping进行映射处理条件
 * 1、spring容器中该Bean的id以"/"开头，是url形式
 */
@org.springframework.stereotype.Controller("/bean2")
public class BeanNameMappingController implements Controller {


    @Override
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {

        ModelAndView modelAndView = new ModelAndView("success.jsp");
        modelAndView.addObject("test", "123456");
        return modelAndView;
    }
}
